<template>
  <a-carousel class="carousel" arrows autoplay>
    <div slot="prevArrow" slot-scope="props" class="custom-slick-arrow" style="left: 10px;z-index: 1;">
      <a-icon type="left-circle"/>
    </div>
    <div slot="nextArrow" slot-scope="props" class="custom-slick-arrow" style="right: 10px;">
      <a-icon type="right-circle"/>
    </div>
    <div class="img" v-for="(item,index) in carouselList" @click="bannerOpen(item)" :key="index" :style="{backgroundImage:'url('+item.imgUrl+')'}">
      <slot name="tip" :title="item.name" :note="item.note" :isShow="item.isShowNameNote"></slot>
    </div>
  </a-carousel>
</template>

<script>
export default {
  name: 'Banner',
  props: {
    carouselList: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    bannerOpen (item) {
      this.$emit('open', item)
    }
  }
}
</script>

<style scoped lang="scss">
.container {
  height: 450px;
  width: 100%;
}

.carousel {
  width: 100%;
  height: 450px;

  .img {
    width: 100%;
    height: 450px;
    background-size: cover;
    background-position: center;
  }
}

.ant-carousel {
  /deep/ .slick-slide {
    text-align: center;
    height: 450px;
    // line-height: 450px;
    background: white;
    overflow: hidden;
  }

  /deep/ .custom-slick-arrow {
    width: 25px;
    height: 25px;
    font-size: 25px;
    color: #fff;
    border-radius: 50%;
    background-color: rgba(31, 45, 61, 0.11);
    opacity: 0.3;
  }

  /deep/ .custom-slick-arrow:before {
    display: none;
  }

  /deep/ .custom-slick-arrow:hover {
    opacity: 0.5;
  }
}
</style>
